/*******************************************************************************
 * Copyright 2011 Mauro Luigi Drago (drago.luigi@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package com.bytenose.extrautils.logging;

import com.bytenose.extrautils.annotations.NonNullable;

/**
 * A logger aware of errors, warnings and info messages.
 * Besides logging, this logger also saves information about messages
 * for further consumption.
 * @author Mauro Luigi Drago
 *
 * @param <ErrorType> 	The type of errors.
 * @param <WarningType> The type of warnings.
 * @param <InfoType>	The type of info messages.
 */
public interface IMultiErrorLogger<ErrorType, WarningType, InfoType> 
	extends IErrorLogger<ErrorType> 
{
	/**
	 * Logs a warning.
	 * 
	 * @param warning the warning, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logWarning(@NonNullable WarningType warning)
			throws IllegalArgumentException;
	
	/**
	 * Saves a warning in the warnings collection.
	 * 
	 * @param warning the warning, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void addWarning(@NonNullable WarningType warning)
			throws IllegalArgumentException;
	
	/**
	 * Saves a warning in the warnings collection and logs it.
	 * 
	 * @param warning the warning, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logAddWarning(@NonNullable WarningType warning)
			throws IllegalArgumentException;
	
	/**
	 * Logs a collection of warnings.
	 * 
	 * @param warnings the warnings, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logWarnings(@NonNullable Iterable<? extends WarningType> warnings)
			throws IllegalArgumentException;
	
	/**
	 * Saves a collection of warnings in the warnings collection.
	 * 
	 * @param warnings the warnings, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void addWarnings(@NonNullable Iterable<? extends WarningType> warnings)
			throws IllegalArgumentException;
	
	/**
	 * Saves and logs a collection of warnings in the warnings collection.
	 * 
	 * @param warnings the warnings, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logAddWarnings(@NonNullable Iterable<? extends WarningType> warnings)
			throws IllegalArgumentException;
	
	/**
	 * Gets all the collected warnings.
	 * 
	 * @return the warnings.
	 */
	@NonNullable Iterable<WarningType> getWarnings();
	
	/**
	 * Logs a info.
	 * 
	 * @param info the info, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logInfo(@NonNullable InfoType info)
			throws IllegalArgumentException;
	
	/**
	 * Saves a info in the infos collection.
	 * 
	 * @param info the info, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void addInfo(@NonNullable InfoType info)
			throws IllegalArgumentException;
	
	/**
	 * Saves a info in the infos collection and logs it.
	 * 
	 * @param info the info, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logAddInfo(@NonNullable InfoType info)
			throws IllegalArgumentException;
	
	/**
	 * Logs a collection of infos.
	 * 
	 * @param infos the infos, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logInfos(@NonNullable Iterable<? extends InfoType> infos)
			throws IllegalArgumentException;
	
	/**
	 * Saves a collection of infos in the infos collection.
	 * 
	 * @param infos the infos, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void addInfos(@NonNullable Iterable<? extends InfoType> infos)
			throws IllegalArgumentException;
	
	/**
	 * Saves and logs a collection of infos in the infos collection.
	 * 
	 * @param infos the infos, cannot be null.
	 * @throws IllegalArgumentException
	 *		if some of the non nullable arguments are null.
	 */
	void logAddInfos(@NonNullable Iterable<? extends InfoType> infos)
			throws IllegalArgumentException;
	
	/**
	 * Gets all the collected infos.
	 * @return the infos.
	 */
	@NonNullable Iterable<InfoType> getInfos();
}
